﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Help.BLL;

namespace HelpView
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            IntegralcomboBox();
            InitListView();
        }

        private void btn_Search_Click(object sender, EventArgs e)
        {

        }

        #region comboBox

        #region 初始化

        private void IntegralcomboBox()
        {
            this.comboBox1.Items.Add("一级分类");
            this.comboBox1.SelectedIndex = 0;
            DataTable dt = Class.GetClass("0");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                this.comboBox1.Items.Add(dt.Rows[i]["classname"].ToString());
            }
        }

        #endregion

        #region Selected事件

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.comboBox2.Items.Clear();
            this.comboBox2.Items.Add("二级分类");
            this.comboBox2.SelectedIndex=0;
            DataTable dt = Class.GetClass("0");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                this.comboBox2.Items.Add(dt.Rows[i]["classname"].ToString());
            }
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.comboBox3.Items.Clear();
            this.comboBox3.Items.Add("三级分类");
            this.comboBox3.SelectedIndex = 0;
            DataTable dt = Class.GetClass("0");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                this.comboBox3.Items.Add(dt.Rows[i]["classname"].ToString());
            }
        }

        #endregion

        #endregion

        #region ListView

        private void InitListView()
        {
            this.listView1.BeginUpdate();
            this.listView1.View = View.Details;
            this.listView1.Columns.Add("序号", 50, HorizontalAlignment.Center);
            this.listView1.Columns.Add("标题", 500, HorizontalAlignment.Center);
            this.listView1.Columns.Add("录入时间", 100, HorizontalAlignment.Center);
            this.listView1.EndUpdate();
        }

        #endregion

        private void ToolStripMenuItem_Input_Click(object sender, EventArgs e)
        {
            MessageBox.Show("功能正在开发中……");
        }

    }
}
